/*
 * @Author: songxiang songxiang0806@qq.com
 * @Date: 2025-08-21 08:57:02
 * @LastEditors: songxiang songxiang0806@qq.com
 * @LastEditTime: 2025-09-02 17:15:58
 * @FilePath: \supermap-webgl\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

const pathResolve = (dir: string) => {
  return resolve(__dirname, '.', dir)
}

// https://vite.dev/config/
export default defineConfig({
  base: process.env.NODE_ENV === 'production' ? '/' : '/',
  root: process.cwd(),
  plugins: [vue()],
  // 配置别名@type
  resolve: {
    alias: [
      // 绝对路径重命名：/@src/xxxx => src/xxxx
      {
        find: /\/@src\//,
        replacement: pathResolve('src') + '/'
      },
      // 绝对路径重命名：/@packages/xxxx => packages/xxxx
      {
        find: /\/@packages\//,
        replacement: pathResolve('packages') + '/'
      }
    ]
  }
})
